package com.sea.task;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.sea.domain.Person;

import java.io.File;
import java.io.IOException;

public class JsonFileWriter {
    public void writeJsonToFile(String data) {
        ObjectMapper objectMapper = new ObjectMapper();

        try {
            objectMapper.writeValue(new File("data.json"), data);
            System.out.println("JSON文件写入成功！");
        } catch (IOException e) {
            System.out.println("JSON文件写入失败：" + e.getMessage());
        }
    }
}

